package com.formiaomiao.demain.controller;

import com.formiaomiao.demain.model.OpinionBean;
import com.formiaomiao.demain.service.OpinionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class OpinionController {
    @Autowired
    OpinionService opinionService;

    /**
     * 意见反馈
     * @param userid
     * @param opinion
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/opinion")
    private Object Opinion(@RequestParam(name = "userid", required = false) Integer userid,
                           @RequestParam(name = "opinion", required = false) String opinion,
                           @RequestParam(name = "mac", required = false) String mac){
        OpinionBean opinionBean = new OpinionBean();
        opinionBean.setUserid(userid);
        opinionBean.setOpinion(opinion);
        opinionBean.setMac(mac);
        return opinionService.upOpinion(opinionBean);
    }
}
